/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.click.app.dao.hibernate;

import com.click.app.dao.StorageMaterialDao;
import com.click.app.model.Material;
import com.click.app.model.StorageMaterial;
import java.util.List;

/**
 *
 * @author orgale
 */
public class StorageMaterialDaoHibernate extends GenericDaoHibernate<StorageMaterial, Long>
                                         implements StorageMaterialDao {

    public StorageMaterialDaoHibernate() {
        super(StorageMaterial.class);
    }

    public List<StorageMaterial> findByIdMaterial(Long idMaterial){
        return getHibernateTemplate().find(" from StorageMaterial " +
                                           " where material.id = ? ", idMaterial);
    }
    public List<StorageMaterial> findByIdMaterialNoCero(Long idMaterial){
        return getHibernateTemplate().find(" from StorageMaterial " +
                                           " where material.id = ? and stock > 0 ", idMaterial);
    }
}
